<?php
$message = '';
$db = new mysqli('localhost', 'root', 'root', 'rashidStone');
if($db->connect_error) {
    $message = $db->connect_error;
} else {
   if($db->error) {
       $message = $db->error;
   }
}

$tag = $_POST['tag'];



if(!empty($_POST['user'])) {
    foreach($_POST['user'] as $userID) {
     $sql = "INSERT INTO TagAssignment(TagID, UserID) VALUES ('$tag', '$userID')";
    
if (!mysqli_query($db,$sql))
{
  die('Error: ' . mysqli_error($db));
}
}
}
echo "added successfully";
    
